<template>
  <div class="examlist_container">
    <div class="title">
      <h2> 法治思维 快乐学法</h2>
    </div>
    <div class="typeSelect">
      <h3>
        排行榜
      </h3>
    </div>
    <div class="examlist toplist">
      <div class="">
        <table border="1" style="width: 100%">
          <thead>
            <tr>
              <th>排名</th>
              <th>姓名</th>
              <th>单位信息</th>
              <th>分数</th>
              <th>用时</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="item in tableData" :key="item.id">
              <td :class="item.rank==1?'top1':(item.rank==2?'top2':'top3')">{{item.rank}}</td>
              <td>{{item.name}}</td>
              <td>{{item.unit}}</td>
              <td>{{item.totalPoint}}</td>
              <td>{{item.examTime}}</td>
            </tr>
          </tbody>
        </table>
      </div>

    </div>
    <div class="hr" style="height:100px"></div>
    <div class="step">
      <van-button round type="info" @click="toIndex()">返回</van-button>
    </div>
  </div>
</template>
<style scoped>
</style>
<script>
import path from '@/network'
import { Toast } from 'vant';
export default {
  name: 'App',

  data () {
    return {
      examInfo: null,//考试详情
      total: 0,
      pagesize: 50,
      currentPage: 1,
      tableData: [],
    };
  },

  created () {
  },

  mounted () {

    this.rank()

  },
  methods: {
    //获取list
    rank () {
      path.rank({
        examId: this.$route.query.id,
        page: this.currentPage,
        pageSize: this.pagesize,
      }).then(res => {
        if (res.success === 0) {
          this.tableData = res.rows
          this.total = res.total;
        }
      })
    },

    toIndex: function () {
      this.$router.push({ name: "index" });
    },

  },
};


</script>